package com.onluy.frameworkcloud.mvc.dao;


import org.apache.ibatis.session.SqlSessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.onluy.frameworkcloud.batis.dao.SqlSessionDao;
import com.onluy.frameworkcloud.data.util.DataMap;

public class BaseSqlSessionDao extends SqlSessionDao {
    protected Logger log = LoggerFactory.getLogger(this.getClass());

    public BaseSqlSessionDao(SqlSessionFactory sqlSessionFactory, String dialect)
            throws InstantiationException, IllegalAccessException, ClassNotFoundException {
        super(sqlSessionFactory, dialect);
    }

    public BaseSqlSessionDao(SqlSessionFactory sqlSessionFactory, String dialect, int exportPageSize)
            throws InstantiationException, IllegalAccessException, ClassNotFoundException {
        super(sqlSessionFactory, dialect, exportPageSize);
    }

    public String getSequence(String sequence) {
        return (String) this.selectOne("CommonSQL.selectSequence", sequence);
    }

    public String getSequenceL16(String sequence) {
        return (String) this.selectOne("CommonSQL.selectSequenceL16", sequence);
    }

    public String getSequenceL20(String sequence) {
        return (String) this.selectOne("CommonSQL.selectSequenceL20", sequence);
    }

    public String getSequence(String sequence, Integer length) {
        DataMap param = new DataMap();
        param.put("sequence", sequence);
        param.put("length", length);
        return (String) this.selectOne("CommonSQL.selectSequenceL", param);
    }

    public String getSysDate() {
        return this.getSysTime().substring(0, 10);
    }

    public String getSysTime() {
        return (String) this.selectOne("CommonSQL.selectCurrentTime");
    }
}